"""modify ai-agent sync-flag

Revision ID: 3f9be791d76b
Revises: 9b87998a2a67
Create Date: 2025-04-06 01:14:22.830841

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision: str = '3f9be791d76b'
down_revision: Union[str, None] = '9b87998a2a67'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('ai_agents', 'system_prompt',
               existing_type=mysql.LONGTEXT(collation='utf8mb4_general_ci'),
               type_=sa.TEXT(length=16777216),
               existing_nullable=True)
    op.alter_column('ai_agents', 'sync_flag',
               existing_type=mysql.INTEGER(),
               type_=sa.String(length=16),
               existing_comment='同步标识',
               existing_nullable=False,
               existing_server_default=sa.text("'1'"))
    op.alter_column('funcall_log', 'log_text',
               existing_type=mysql.LONGTEXT(collation='utf8mb4_general_ci'),
               type_=sa.TEXT(length=16777216),
               existing_comment='日志信息',
               existing_nullable=True)
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('funcall_log', 'log_text',
               existing_type=sa.TEXT(length=16777216),
               type_=mysql.LONGTEXT(collation='utf8mb4_general_ci'),
               existing_comment='日志信息',
               existing_nullable=True)
    op.alter_column('ai_agents', 'sync_flag',
               existing_type=sa.String(length=16),
               type_=mysql.INTEGER(),
               existing_comment='同步标识',
               existing_nullable=False,
               existing_server_default=sa.text("'1'"))
    op.alter_column('ai_agents', 'system_prompt',
               existing_type=sa.TEXT(length=16777216),
               type_=mysql.LONGTEXT(collation='utf8mb4_general_ci'),
               existing_nullable=True)
    # ### end Alembic commands ###
